<template>
  <view class="index-container">
    <view class="header">
      <text class="welcome">欢迎回来，{{ studentName }}</text>
    </view>
    
    <view class="content">
      <text>这里是学生首页</text>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      studentName: ''
    }
  },
  onLoad() {
    // 获取用户信息
    try {
      const userInfo = uni.getStorageSync('userInfo');
      if (userInfo) {
        const info = JSON.parse(userInfo);
        this.studentName = info.name || info.username;
      }
    } catch (e) {
      console.error('获取用户信息失败', e);
    }
  }
}
</script>

<style>
.index-container {
  min-height: 100vh;
  padding: 20px;
  background-color: #f5f5f5;
}

.header {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.welcome {
  font-size: 18px;
  color: #333;
}

.content {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
</style>
